package com.hd.springbootstudy.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import javax.validation.constraints.NotNull;

/**
 * @Author: Lemon
 * @Date: 2021/4/20 21:25
 * 用户实体类
 */
@Data
/**
 * 对应数据库表名
 */
@TableName("tb_user")
public class User {
    /**
     * 对应数据库表id
     */
    @TableId(type = IdType.AUTO)
    private Integer id;
    /**
     * 对应数据库相应字段
     */
    @TableField("username")
    /**
     * JSR303校验空值判断
     */
    @NotNull(message = "用户名为空")
    private String userName;

    public User(Integer id, String userName) {
        this.id = id;
        this.userName = userName;
    }

    public User(String userName) {
        this.userName = userName;
    }

    public User() {
    }
}
